<%--
  Created by IntelliJ IDEA.
  User: Edward_yang
  Date: 2018/1/8 0008
  Time: 15:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<!DOCTYPE html>
<html>
<body style="padding:0px" >
<script type="text/javascript" src="${staticPath }/static/autoCompleteData.js" charset="utf-8"></script>
<script type="text/javascript">
    $(function () {
        autoCompleteDate('${path}/specialist/autoCompleteSellerData.do', 'autocomplete-ajax-edit2', 'sellerId', 'autocomplete-ajax-edit-x2');
        autoCompleteDate('${path}/specialist/autoCompleteHospitalDepartmentData.do', 'autocomplete-ajax-edit3', 'hospitalDepartmentId', 'autocomplete-ajax-edit-x3');
    })
</script>
<script  type="text/javascript">
    //提交from数据
    function submitForm() {
        progressLoad();
        $.ajax({
            cache: true,
            type: "POST",
            url:"${path }/specialist/edit.do",
            data:$('#saveinfoSeller').serialize(),// 你的formid
            async: false,
            error: function(request) {
                progressClose();
                $.messager.alert("删除失败", "服务器连接失败!","error");
            },
            success: function(data) {
                progressClose();
                if (data.success) {
                    $.messager.alert("系统提示", "保存成功","info",function(){
                        closeWin('modelEdit');
                        reloadSpecialistDataGrid();
                    });

                }else{
                    progressClose();
                    $.messager.alert("系统提示", data.msg,"error");
                }
            }
        });

    }


</script>
<style type="text/css">
    .grid{
        font:12px arial,helvetica,sans-serif;
        border: 0px solid #8DB2E3;width:100%;
        border-collapse:collapse;
    }
    .grid td{
        font:100% arial,helvetica,sans-serif;
        text-align: center;
        height:40px;
        border:1px solid #e0e0e0;
        padding-left:5px}
    .tdcc{
        height:40px;
        width: 90px;
        background-color: rgb(250,250,250);
    }
    .tdcc1{
        height:40px;
        width:210px;
    }
    .imgDelete{
        display: inline-block;
        height: 17px;
        width: 17px;
        border-radius: 50%;
        background-color: #888;
        text-align: center;
        color: #fff;
        line-height: 16px;
        font-size: 12px;
        cursor: pointer;
        position: absolute;
        right: -8px;
        top: -8px;
    }
    .dragItemBox{
        position: relative;margin-right: 10px;margin-top: 5px;float: left;
    }
</style>
<form id="saveinfoSeller" action="" method="post">
    <div class="easyui-tabs"  data-options="tabWidth:120"  style="width:100%;height:533px ;padding:0px">
        <!--专家基本信息Start-->
        <input class="easyui-validatebox" name="id" data-options="required:true" value="${specialist.id}" hidden/>
        <div title="专家基本信息"  data-options="iconCls:'icon-edit'" style="padding:20px">
            <table class="grid" align="center">
                <tr >
                    <td  class="tdcc2" colspan="6"><h2>专家基本信息</h2></td>
                </tr>
                <tr>
                    <td class="tdcc">姓名:</td>

                    <td class="tdcc1">
                        <input class="easyui-validatebox" name="name" data-options="required:true" value="${specialist.name}"/>
                    </td>
                    <td  class="tdcc">用户账号:</td>
                    <td tdcc1>
                        <input type="hidden"  class="easyui-validatebox" name="userId" data-options="required:true"   value="${specialist.userId}"/>
                        <input class="easyui-validatebox" name="userId" data-options="required:true"  readonly  value="${specialistMap.userPhone}"/>
                    </td>

                    <td colspan="2" rowspan="2"><img height="100px" width="100px" src="${specialist.img}" id="tpyl"/></td>
                </tr>
                <tr>

                    <td class="tdcc">联系电话:</td>
                    <td class="tdcc1"> <input  class="easyui-validatebox" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" name="tel" data-options="required:true" value="${specialist.tel}"/></td>
                    <td class="tdcc">所属医院:</td>
                    <td class="tdcc1">
                        <div style="position: relative;height:60px;width: 60px;" >
                            <input  type="hidden"  name="sellerId" id="sellerId" value="${specialist.sellerId}" />
                            <input type="text" id="autocomplete-ajax-edit2"    class="easyui-validatebox" data-options="missingMessage:'填写所属医院',required:true"   value="${specialistMap.sellerName}" style="position: absolute; z-index: 2; background: transparent;margin: 21px 40px 0 0; "/>
                            <input type="text" id="autocomplete-ajax-edit-x2" disabled="disabled" style="color: #CCC; position: absolute; background: transparent; z-index: 1;margin: 21px 40px 0 0;"/>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="tdcc">职位:</td>
                    <td class="tdcc1">  <input class="easyui-validatebox"  name="professionPosition" data-options="required:true" value="${specialist.professionPosition}"/></td>
                    <td class="tdcc">所属科室:</td>
                    <td class="tdcc1">
                        <div style="position: relative;height:60px;width: 60px;" >
                            <input type="hidden" name="hospitalDepartmentId" id="hospitalDepartmentId" value="${specialist.hospitalDepartmentId}" />
                            <input type="text" id="autocomplete-ajax-edit3"    class="easyui-validatebox" data-options="missingMessage:'选择科室',required:true"   value="${specialistMap.hospitalDepartmentName}" style="position: absolute; z-index: 2; background: transparent;margin: 21px 40px 0 0; "/>
                            <input type="text" id="autocomplete-ajax-edit-x3" disabled="disabled" style="color: #CCC; position: absolute; background: transparent; z-index: 1;margin: 21px 40px 0 0;"/>
                        </div>
                    </td>
                    <td colspan="2">
                        <div id="upload_ue"></div>
                        <span>专家照片:</span>
                        <input class="easyui-validatebox"  id="img"  value="${specialist.img}" readonly="readonly"  name="img" data-options="required:true"/>
                        <a href="javascript:void(0);"  class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick="upImage();">上传图片</a>
                    </td>
                    <script type="text/javascript">
                        var _editor;
                        $(function() {
                            //重新实例化一个编辑器，防止在上面的editor编辑器中显示上传的图片或者文件
                            _editor = UE.getEditor('upload_ue',{
                                serverUrl:"${path}/file/upload.do?compress=1"
                            });

                            _editor.ready(function () {
                                //设置编辑器不可用
                                // _editor.setDisabled();
                                //隐藏编辑器，因为不会用到这个编辑器实例，所以要隐藏
                                _editor.hide();
                                //侦听图片上传
                                _editor.addListener('beforeInsertImage', function (t, arg) {
                                    //有多少张图片arg.length就是多大
                                    $("#img").val(arg[0].src);
                                    $("#tpyl").attr("src",arg[0].src);
                                });
                            });
                        });
                        //弹出图片上传的对话框
                        function upImage() {
                            var myImage = _editor.getDialog("insertimage");
                            myImage.open();
                        }
                    </script>
                </tr>
                <tr>
                    <td  class="tdcc">排序:</td>
                    <td class="tdcc1"> <input  class="easyui-validatebox" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"  name="ord" data-options="required:true" value="${specialist.ord}"/></td>
                    <td  class="tdcc">擅长:</td>
                    <td colspan="3"><textarea  name="beAdeptAt" class="easyui-validatebox"  style="width: 600px   ; height: 80px;resize:none;" placeholder="描述所擅长的医疗" >${specialist.beAdeptAt}</textarea></td>
                </tr>
            </table>
        </div>
        <!--****************************************************end**********************************************************************************************************************************************************************************************************-->
        <style>
            .td1{
                border: 1px solid #e0e0e0;
                background-color: #e0e0e0;
                text-align: center;
                height: 60px;
            }
        </style>
        <div title="图文详情" data-options="iconCls:'icon-edit'" style="padding:20px">
            <table style=" border: 1px solid #e0e0e0;">
                <tr>
                    <td class="td1"><h2>专家简介</h2></td>
                </tr>
                <tr>
                    <td>
                        <div>
                            <textarea id="editor" style="height:400px;"  name="detail">${specialist.detail}</textarea>
                        </div>
                    </td>
                </tr>

            </table>
        </div>
        <script type="text/javascript">
            //实例化编辑器
            //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
            var ue = UE.getEditor('editor',{
                serverUrl:"${path}/file/upload.do"
            });
        </script>
    </div>
    <div  data-options="region:'south',border:false" style="height: 24px; padding-top: 8px;text-align: center" >
        <a  class="easyui-linkbutton" icon="icon-save" onclick="submitForm()" >保存</a>
        <a  class="easyui-linkbutton" icon="icon-cancel" onclick="closeWin('modelEdit')" >取消</a>
    </div>
</form>
</body>
</html>